package com.app.common.base

import androidx.appcompat.app.AppCompatActivity

object ActivityManager {
    private val activityList = arrayListOf<AppCompatActivity>()

    fun addActivity(activity: AppCompatActivity) {
        activityList.add(activity)
    }

    fun removeActivityFinish(activity: AppCompatActivity) {
        activityList.remove(activity)
        activity.finish()
    }

    fun removeActivity(activity: AppCompatActivity) {
        activityList.remove(activity)
    }

    fun clearActivity() {
        activityList.iterator().forEach {
            activityList.remove(it)
            it.finish()
        }
    }

}